<?php
use_helper('I18N');
/** @var Array of menu items */ $items = $sf_data->getRaw('items');
/** @var Array of categories, each containing an array of menu items and settings */ $categories = $sf_data->getRaw('categories');
?>

<script type="text/javascript">
    $('#titre').click(function(){
        $('#DashBoard').width(100);
    })
</script>
<table id="wrapper">
    <tr>
        <td id="DashBoard">
            <div id="sf_admin_container">
                <h1 id="titre"><img src="/sfAdminDashPlugin/images/medium/paste_f2.png" alt="Menu"  style="vertical-align: middle;"/>Menu</h1>
                <?php if (count($items)): ?>
                    <?php include_partial('dash_list', array('items' => $items)); ?>
                <?php endif; ?>
                <?php if (count($categories)): ?>
                    <?php foreach ($categories as $name => $category): ?>
                        <?php if (sfAdminDash::hasPermission($category, $sf_user)): ?>
                <script type="text/javascript">
                    // slide toggles sur les menus
                    $(function(){
                        $('#<?php echo $name ?>_h2').click(function(){
                            $('#<?php echo $name ?>_div').slideToggle(250);
                        })
                        if('<?php echo $name ?>' != 'CRM' && '<?php echo $name ?>' != 'Organisation'){
                            $('#<?php echo $name ?>_div').hide();
                        }

                    })
                </script>

                <h2 id="<?php echo $name ?>_h2"><?php echo __(isset($category['name']) ? $category['name'] : $name, null, 'sf_admin_dash'); ?></h2>
                            <?php include_partial('dash_list', array('items' => $category['items'], 'name'=> $name)); ?>
                        <?php endif; ?>
                    <?php endforeach; ?>
                <?php elseif (!count($items)): ?>
                    <?php echo __('sfAdminDashPlugin is not configured.  Please see the %documentation_link%.', array('%documentation_link%'=>link_to(__('documentation', null, 'sf_admin_dash'), 'http://www.symfony-project.org/plugins/sfAdminDashPlugin?tab=plugin_readme', array('title' => __('documentation', null, 'sf_admin_dash')))), 'sf_admin_dash'); ?>
                <?php endif; ?>
            </div>
        </td>
        <td id="agenda">
            <div id="sf_admin_container">
                <h1><img src="/sfAdminDashPlugin/images/medium/properties_f2.png" alt="Agenda" style="vertical-align: middle;"/>Agenda <span class="ui-button" id="agrandir">[Agrandir]</span></h1>
                <!--- inclusion de fullCalendar -->
                <?php if(!strpos($sf_request->getPathInfo(),'agenda')) { ?>
                <script type="text/javascript" src="/js/big_calendar.js"></script>
                    <?php }  ?>
                <div id="calendar"></div>
            </div>
        </td>
    </tr>
</table>
<script type="text/javascript">
    // agrandissement agenda
    var agrandi = false;
    var taille_prec;
    $('#agrandir').click(function(){
        if(agrandi == false){
            taille_prec = $('#calendar').width();
            $('#DashBoard').hide();
            $('#calendar').width('100%');
            $('#calendar').fullCalendar('option', 'contentHeight', 1000);
            $('#agrandir').html('[R&eacute;tr&eacute;cir]')
            agrandi = true;
        }else{
            $('#DashBoard').show();
            $('#calendar').fullCalendar('option', 'contentHeight', 570);
            $('#calendar').width(taille_prec);
            $('#agrandir').html('[Agrandir]')
            agrandi = false;
        }
    })
</script>